<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\admin\model\Order;
use app\admin\model\Address;
use app\admin\model\Userticket;
use app\common\model\User;
use fast\Random;
use addons\epay\library\Service;
use think\Db;

/**
 * 示例接口
 */
class Demo extends Api
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    public function index()
    {
        $payamount = 0.01;
        $out_trade_no = 'TK20251108175902926780';
        $detail =   Userticket::where('order_id',$out_trade_no)->find();
        //1.修改订单状态
        $detail->status = 1;
        $detail->pay_money = $payamount;
        $detail->pay_time = time(); 
        $detail->save();
        User::getScoreAndWater($detail->user_id,$payamount);//二级分销
        Db::name('user_ticket_record')->where('ticket_id',$detail['id'])->update(['status' => 1,'pay_time' => time()]);
        Db::name('ticket')->where('id',$detail['ticket_id'])->dec('num',$detail->num);
    }
       
    //    $list=  Service::transfer(['orderId' =>'test1234567','openid' =>  'oEJhv1z-iLVCwsFxIJuKYd-gwdPs','amount' => '0.01']);
    //    $this->success('suc',$list);
       
    }
    
     

    

    


